package cn.guoshiweixue.security.controller;

import cn.guoshiweixue.security.model.User;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author guoshiweixue
 */
@RestController
@RequestMapping("/security")
public class HelloController {

    @Value("${hello.message}")
    private String helloMessage;

    @Operation(summary = "Say hello", description = "Returns a friendly greeting")
    @GetMapping("/hello")
    public String sayHello() {
        return helloMessage;
    }

    @Operation(summary = "Get user details", description = "Returns user details based on ID")
    @GetMapping("/getUser/{id}")
    public User getUser(@PathVariable Long id) {
        // Dummy data for demonstration
        User user = new User();
        user.setId(id);
        user.setUserName("WeiXue Security");
        user.setUserAge(1);
        return user;
    }
}
